package com.jml.dubboconsumer.service;

import com.jml.interfaces.member.UserService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class OrderService {

	public static void main(String[] args) {
		addOrder();
	}

	public static void addOrder() {
		ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("consumer.xml");
		applicationContext.start();
		System.out.println("消费者启动成功，成功注册zookeeper");
		System.out.println("###order服務,开始调用生产者服务");
		//这里得到的只是一个代理对象
		UserService userService=(UserService) applicationContext.getBean("userService");
		//通过反射，进行rpc通信获取数据
		String userName = userService.getUser(1L);
		System.out.println("###order服務,结束调用生产者服务,userName:" + userName);
	}


}
